<?php $ArSectors = Dracosys::getSessionValue(SESSION_INTERFACE, 'SectorList'); ?>

<section id="SectorList">
    <h2>Listagem de Setores</h2>
    <table id="SectorList_sectors" class="list">
        <thead>
            <tr>
                <th>Nome do Setor</th>
                <th>Departamento</th>
                <th>Nº de Funcionários</th>
                <th>Visualizar</th>
                <th>Editar</th>
                <th>Desativar</th>
            </tr>
        </thead>
        <tfoot>
        </tfoot>
        <tbody>
            <?php
            if( !empty($ArSectors) ):
                foreach($ArSectors as $Sector): ?>
                    <tr>
                        <td><?=$Sector->getStNome()?></td>
                        <td><?=$Sector->getDepartamento()->getStNome()?></td>
                        <td><?=$Sector->countEmployees()?></td>
                        <td>
                            <a href="<?=DRA_URL?>setor/visualizar-setor/id/<?=$Sector->getIDSetor()?>"  title="Visualizar">
                                <img src="<?= DRA_VIEW_URL ?>images/descricao.png" />
                            </a>
                        </td>
                        <td>
                            <a href="<?=DRA_URL?>setor/editar-setor/id/<?=$Sector->getIDSetor()?>" title="Editar">
                                <img src="<?= DRA_VIEW_URL ?>images/edit.png" alt="Editar" />
                            </a>
                        </td>
                        <td>
                            <a href="<?=DRA_URL?>setor/excluir-setor/id/<?=$Sector->getIDSetor()?>" title="Excluir">
                                <img src="<?= DRA_VIEW_URL ?>images/delete.png" alt="Editar" />
                            </a>
                        </td>
                    </tr>
            <?php endforeach;
            else:
            ?>
                <tr class="nodata">
                    <td colspan="6">
                        Nenhum resultado foi encontrado!
                    </td>
                </tr>
            <?php
            endif;
            ?>
        </tbody>
    </table>
    <div class="insertInList">
        <a href="<?=DRA_URL?>setor/cadastrar-setor" class="insertIcon">Cadastrar novo Setor</a>
    </div>
</section>